namespace ManifestGeneration
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.Robotics.Hardware.EV4;
    using System.IO;
    using System.Xml;
    using System.Runtime.Serialization;
    using System.Collections;
    using System.Threading;
    using Microsoft.Robotics.Runtime;
    using Microsoft.Robotics.Hardware.DAC;
    using Microsoft.Robotics.Numerics;

    class Program
    {
        static void Main(string[] args)
        {
            ////Microsoft.Robotics.Hardware.EV4.DeviceConfiguration config = new DeviceConfiguration();
            ////FileStream file = new FileStream("EV4.config.xml", FileMode.OpenOrCreate);
            ////System.Xml.Serialization.XmlSerializer xserial = new System.Xml.Serialization.XmlSerializer(typeof(DeviceConfiguration));
            ////xserial.Serialize(file, config);
            ////file.Close();

            List<AccelerometerState> accelStates = new List<AccelerometerState>()
            {
                    new AccelerometerState()
                    {
                        AccelerationInG = new Vector3(1,2,3),
                        DeviceId = 27,
                        DeviceType = DeviceType.Accelerometer,
                        Model = "Foo",
                        Pose = new Pose(new Vector3(4,5,6), new Quaternion(6,5,4,1.23)),
                        TimestampInMilliseconds = 23456,
                        TimestampInTicks = 234567
                    },
                    new AccelerometerState()
                    {
                        AccelerationInG = new Vector3(4,5,6),
                        DeviceId = 72,
                        DeviceType = DeviceType.Accelerometer,
                        Model = "Foo2",
                        Pose = new Pose(new Vector3(4,5,6), new Quaternion(6,5,4,1.23)),
                        TimestampInMilliseconds = 23456,
                        TimestampInTicks = 234567
                    },
                    new AccelerometerState()
                    {
                        AccelerationInG = new Vector3(1,2,3),
                        DeviceId = 27,
                        DeviceType = DeviceType.Accelerometer,
                        Model = "FooTheThird",
                        Pose = new Pose(new Vector3(4,5,6), new Quaternion(6,5,4,1.23)),
                        TimestampInMilliseconds = 23456,
                        TimestampInTicks = 234567
                    },
            };

            HeartbeatAgent.AccelerometerMessage testState = new HeartbeatAgent.AccelerometerMessage(accelStates);

            FileStream ofile = new FileStream("AccelStates.xml", FileMode.OpenOrCreate);
            DataContractSerializer ser = new DataContractSerializer(typeof(HeartbeatAgent.AccelerometerMessage));
            ser.WriteObject(ofile, testState);
            ofile.Close();
        }
    }
}
